/**
 * Copyright (c) 2013-2022 Nikita Koksharov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.redisson.client.protocol.convertor;

import org.redisson.api.JsonType;


/**
 * 专门用于 JsonType 类型的转换。
 */
public class JsonTypeConvertor implements Convertor<JsonType> {

    /**
     * 将给定对象转换为 JsonType 枚举。
     *
     * @param obj 需要转换的对象。该对象将被转换为其字符串形式，并且该字符串将被转换为大写形式的 JsonType 枚举。
     * @return 转换后的 JsonType 枚举实例。
     */
    @Override
    public JsonType convert(Object obj) {
        // 将对象转换为大写字符串，然后根据该字符串值转换为对应的 JsonType 枚举
        return JsonType.valueOf(obj.toString().toUpperCase());
    }
}
